<template>
  <el-container>
    <el-main>
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>会议的申请</el-breadcrumb-item>
      </el-breadcrumb>

      <!--   表单-->
      <div style="width: 700px;height: 600px ;margin: 20px 0;margin-left: 80px" >
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="申请人">
          <el-input v-model="form.username"></el-input>
        </el-form-item>
        <el-form-item label="申请人Id">
          <el-input v-model="form.userId"></el-input>
        </el-form-item>

        <el-form-item label="会议状态">
          <el-select v-model="form.state" placeholder="默认未审核">
            <el-option label="未审核" value="未审核" onselect="this"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="会议主题">
          <el-input v-model="form.conferenceTheme"></el-input>
        </el-form-item>

        <el-form-item label="会议内容">
          <el-input type="textarea" v-model="form.contentDescription"></el-input>
        </el-form-item>
        <el-form-item label="开会地点">
          <el-input v-model="form.address"></el-input>
        </el-form-item>

        <el-form-item label="开始时间">
          <el-date-picker clearable style="width:220px"
                          v-model="form.startTime"
                          type="datetime"
                          format="yyyy-MM-dd HH:mm:ss"
                          value-format="yyyy-MM-dd HH:mm:ss"
                          placeholder="请选择开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间时间">
          <el-date-picker clearable style="width:220px"
                          v-model="form.endTime"
                          type="datetime"
                          format="yyyy-MM-dd HH:mm:ss"
                          value-format="yyyy-MM-dd HH:mm:ss"
                          placeholder="请选择结束时间">
          </el-date-picker>
        </el-form-item>

        <el-form-item>
          <el-button style="margin-left: 50px">取消</el-button>
          <el-button type="primary" @click="onSubmit" style="margin-left: 80px">立即申请</el-button>
        </el-form-item>
      </el-form>
      </div>
    </el-main>
  </el-container>
</template>
<script>

  import request from "../../utils/request";

  export default {
    name: "MeetingApply",
    data() {
      return {
        form: {
          username: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: '',
          userId: ''
        }
      }
    },
    created() {
      //把浏览器的用户信息提取出来
      var UserJsonStr = sessionStorage.getItem("user")
      //转化为json
      var userEntiy = JSON.parse(UserJsonStr)
      //拿到用户名和对应的Id
      this.form.username = userEntiy.userName
      this.form.userId = userEntiy.userId
    },
    methods:{
      onSubmit() {
       request.post("meeting/insertOrUpdate",this.form).then(res =>{
         if (res){
           this.$message.success("会议申请成功,等待管理员审核");

         }else {
           this.$message.error("出错了!请检查网络以后再试一次");
         }
       })
      }
    }
  };
</script>
<style scoped lang="less">
</style>
